<template>
  <div>
    <h1>provideB组件</h1>
    <div class="box"></div>
  </div>
  <button @click="changeColor">修改color</button>
</template>

<script setup lang=ts>
import { inject,Ref } from 'vue';


const color = inject<Ref<string>>("color")
const changeColor = () => {
  color!.value = "yellow"
}

</script>

<style scoped>
.box{
  height:100px;
  width:100px;
  background: v-bind(color);
}
</style>